cmake_minimum_required(VERSION 3.8)
project(agv_tcp_bridge)

if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 17)
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(std_srvs REQUIRED)
find_package(agv_msgs REQUIRED)
find_package(agv_srvs REQUIRED)
find_package(slam_ros_msgs REQUIRED)
#find_package(reflector_slam_ros REQUIRED)
#find_package(agv_ftp_log REQUIRED)
find_package(jsoncpp REQUIRED)
find_package(shared_parameters REQUIRED)
find_package(Boost REQUIRED COMPONENTS system)

add_executable(tcp_bridge
  src/tcp_bridge.cpp
  src/tcp_server.cpp
  src/Subscriber.cpp
  src/ServiceOperate.cpp
  src/agv_msgs_converter.cpp
  src/ros_json_converter.cpp
  src/get_msgs_from_json.cpp
  src/get_srvs_from_json.cpp
)

target_include_directories(tcp_bridge 
  PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
    ${Boost_INCLUDE_DIRS}
)

ament_target_dependencies(
  tcp_bridge 
  rclcpp
  std_msgs
  geometry_msgs
  sensor_msgs
  std_srvs
  agv_msgs
  agv_srvs
  slam_ros_msgs
  #reflector_slam_ros
  #agv_ftp_log
  jsoncpp
  shared_parameters
)

target_link_libraries(tcp_bridge 
  Boost::boost
  Boost::system
  jsoncpp
)

install(TARGETS tcp_bridge  
  DESTINATION lib/${PROJECT_NAME}
)

install(DIRECTORY launch/
  DESTINATION share/${PROJECT_NAME}/launch
)

ament_export_dependencies(
  rclcpp
  std_msgs
  geometry_msgs
  sensor_msgs
  std_srvs
  agv_msgs
  agv_srvs
  #slam_ros_msgs
  #reflector_slam_ros
  jsoncpp
  Boost
)

ament_package()